/*
 * Copyright (C) 2012 JiangHongTiao
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package sk.lieskove.jianghongtiao.paris.core;

import java.io.File;
import javax.persistence.Query;
import sk.lieskove.jianghongtiao.commonpersist.Persist;
import sk.lieskove.jianghongtiao.paris.core.classify.BatchClassification;
import sk.lieskove.jianghongtiao.paris.core.classify.BatchClassificationProperties;
import sk.lieskove.jianghongtiao.websearch.persistence.ClassificationStorage;

/**
 *
 * @author xjuraj
 */
public class AisaRunTest {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        System.out.println("Test DB connection");
        Persist p = Persist.getSingleton();
        Query query = p.getEntityManager().
                createQuery("SELECT COUNT(cs.id) FROM ClassificationStorage cs");
        Long c = (Long) query.getSingleResult();
        System.out.println("Number of items in table ClassificationStorage: " + c);
        System.getProperties().list(System.out);

        ClassificationStorage item = p.getEntityManager().find(ClassificationStorage.class, new Long(26545));
        if (item != null) {
            System.out.println("Item Id: " + item.getId());
            System.out.println("Item Class: " + item.getDocumentType());
            System.out.println("WSR Id" + item.getWebSearchResponse().getId());
            System.out.println("WSR Title" + item.getWebSearchResponse().getTitle());
        } else {
            System.out.println("Item was null!");
        }
        
        BatchClassification.batchClassify(new BatchClassificationProperties(new 
                File("/home/xjuraj/Projects/master-thesis/Paris/settings/batchSettings.xml")));
        
        
        
        
        //        TestSet testSet = learnSet.createTestSet();
        //        System.out.println("Baseline: "+testSet.getBaseline());
        //        System.out.println("Lang: "+testSet.getLang());
        //        for (TestSetClassificationStorage testSetList : testSet.getTestSetClassificationStorage()) {
        //            System.out.println("DocType: "+testSetList.getClassificationStorage().getDocumentType());
        //        }
    }
}
